package com.ff.xyh.feign.client.post;

import com.ff.xyh.common.entity.post.PostJoiner;
import com.ff.xyh.common.entity.result.ResultObject;
import com.ff.xyh.common.qo.post.PostJoinerQuery;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther FF
 * @Date 2022年 11月 15日
 * @Time 23:42
 */
@FeignClient(value = "service-post", contextId = "PostJoinerClient")
@RequestMapping("/post-service")
public interface PostJoinerClient {


    /**
     * 拼单参与者 - 条件查询，包含分页
     * @param postJoinerQuery
     * @return
     */
    @PostMapping("get-complaint-handle-condition")
    ResultObject getPostJoinerCondition(
            @RequestBody PostJoinerQuery postJoinerQuery) ;

    @PostMapping("get-joiner-post-id-type")
    ResultObject getEffectivePostJoinersWithPostIdAndPostType(
            @RequestParam(name = "postId") String postId,
            @RequestParam(name = "postType") int postType) ;

    @PostMapping("get-accepted-joiner-post-id-type")
    ResultObject getAcceptedPostJoinersWithPostIdAndPostType(
            @RequestParam(name = "postId") String postId,
            @RequestParam(name = "postType") int postType) ;

    /**
     * 根据帖子和用户id，查询拼单参与者
     * @param postId
     * @param postType
     * @param userId
     * @param talkRequired 是否筛选可发言的
     * @return
     */
    @PostMapping("get-joiner-post-id-type-user-id-strict")
    ResultObject getPostJoinerWithPostIdAndTypeAndUserId(
            @RequestParam(name = "postId") String postId,
            @RequestParam(name = "postType") int postType,
            @RequestParam(name = "userId") String userId,
            @RequestParam(name = "strict", required = false) boolean talkRequired) ;

    @PostMapping("get-joiners-user-id-status")
    ResultObject getPostJoinerListByUserIdAndJoinerStatus(
            @RequestParam(name = "joinerStatus") int joinerStatus,
            @RequestParam(name = "userId") String userId) ;

    @PostMapping("insert-joiner")
    ResultObject insertPostJoiner(
            @RequestBody PostJoiner postJoiner) ;

    @PostMapping("delete-joiner")
    ResultObject deletePostJoiner(
            @RequestBody PostJoiner postJoiner) ;

    /**
     * 修改参与数量
     * @param postId
     * @param postType
     * @param number
     * @return
     */
    @PostMapping("change-joiner-number")
    ResultObject changePostJoinerNumber(
            @RequestParam("postId") String postId,
            @RequestParam("postType") Integer postType,
            @RequestParam("userId") String userId,
            @RequestParam("number") Integer number) ;

    @PostMapping("change-joiner-status")
    ResultObject changePostJoinerStatus(
            @RequestParam("postId") String postId,
            @RequestParam("postType") Integer postType,
            @RequestParam("userId") String userId,
            @RequestParam("joinerStatus") Integer joinerStatus) ;

}
